home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / Animation Assistant API / Delete Events Example / DeleteEvents.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-27  |  2.6 KB  |  124 lines  |  [TEXT/KAHL]

  1. #if 0
  2. /****************************************************************************************
  3.  
  4.  
  5.         DeleteEvents.c
  6.  
  7.  
  8.         ©1994 Specular International Ltd.
  9.  
  10.         Revision History
  11.  
  12.         when        who            what & why
  13.         ==========    ==========    ======================================================
  14.         3/1/94        paul        new today
  15.  
  16. *****************************************************************************************/
  17. #endif
  18.  
  19. #include <SetUpA4.h>            /**  Generates code; should be first.  **/
  20.  
  21. #include <stddef.h>
  22. #include <Memory.h>
  23. #include "IASInterface.h"
  24.  
  25.  
  26. /**  Internally used routines.  **/
  27. unsigned long        manipulate_events(IASObjectInfoPtr  object_info);
  28.  
  29.  
  30.  
  31. /**
  32.  **  main()
  33.  **
  34.  **  Entry point for the plug-in animation assistant.
  35.  **
  36.  **  This is called first with the <kIAS_SetupStorage> message.
  37.  **  The <storage> param should be used to pass this info back.
  38.  **  The plugin must not depend on any global variables being valid
  39.  **  across calls. The contents of the <storage> must be a monolithic
  40.  **  application heap Handle.
  41.  **
  42.  **  It is then called with the <kIAS_GetParams> message,
  43.  **  which will allow the assistant to put up a dialog box asking
  44.  **  the user for parameters.
  45.  **
  46.  **  It is then called with the <kIAS_ManipulateEvents> message
  47.  **  with the info of the objects and their selected events in the <param> field.
  48.  **  It may be called repeatedly if there are a ton of events selected.
  49.  **
  50.  **  Finally, it is called with the <kIAS_CleanUpStorage> message.
  51.  **
  52.  **  The <param> field will be NULL for all but the kIAS_ManipulateEvents
  53.  **  messages.
  54.  **/
  55.  
  56. unsigned long        main(long  message, void  *param, Handle  *storage) {
  57.  
  58.     unsigned long            err;
  59.     
  60.     
  61.     /**
  62.      **  In case we use globals, set up A4 to refer to them.
  63.      **/
  64.      
  65.     RememberA0();
  66.     SetUpA4();
  67.     
  68.     err = 0;
  69.     switch(message)
  70.     {
  71.         case kIAS_SetupStorage:
  72.             break;                /**  No storage to set up.  **/
  73.             
  74.         case kIAS_GetParams:
  75.             break;                /**  No params to get.  **/
  76.  
  77.         case kIAS_ManipulateEvents:
  78.             err = manipulate_events((IASObjectInfoPtr) param);
  79.             break;
  80.             
  81.         case kIAS_CleanUpStorage:
  82.             break;                /**  Nothing to clean up.  **/
  83.     }
  84.     
  85.     RestoreA4();
  86.     return(err);
  87.     
  88. }  /**  End of main().  **/
  89.  
  90.  
  91.  
  92.  
  93. /**
  94.  **  manipulate_events()
  95.  **
  96.  **  Deletes the selected events.
  97.  **/
  98.  
  99. unsigned long        manipulate_events(IASObjectInfoPtr  object_info)
  100. {
  101.     while(object_info != NULL)
  102.     {
  103.         IASEventPtr        event;
  104.         
  105.         
  106.         event = object_info->selected_events;
  107.         while(event != NULL)
  108.         {
  109.             /**
  110.              **  Set the time to -1 to indicate that we wish to delete
  111.              **  this event.
  112.              **/
  113.              
  114.             event->time = -1;
  115.             event = event->next;
  116.         }
  117.         object_info = object_info->next;    
  118.     }
  119.  
  120.     return(0);
  121.     
  122. }  /**  End of manipulate_events().  **/
  123.  
  124.